{% extends 'template.html' %}

{% block username %}
    {{ head.username }}
{% endblock %}

{% block content %}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">{{ head.value }}</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div class="btn-group">
                            <a>
                                <button id='bt-add' type="button" class="btn btn-primary">增加</button>
                            </a>
                            <a>
                                <button id='bt-del' data-text="确定删除所选的资产模板? 0个" type="button" class="btn btn-danger">
                                    删除
                                </button>
                            </a>
                        </div>
                        <div class="pull-right">
                            <div class="btn-group">
                            </div>
                        </div>
                    </div>
                    <div class="panel-body">
                        <table id="mytable" class="display" width="100%" cellspacing="0">
                            <thead>
                            <tr>
                                <th class="center sorting_disabled">
                                    <label class="pos-rel">
                                        <input id='chb-all' type="checkbox"/>
                                    </label>
                                </th>
                                <th>id</th>
                                <th>模板名称</th>
                                <th>资产名称</th>
                                <th>cpu</th>
                                <th>主板</th>
                                <th>固态硬盘</th>
                                <th>机械硬盘</th>
                                <th>内存</th>
                                <th>显卡</th>
                                <th>品牌</th>
                                <th>规格</th>
                                <th>使用部门</th>
                                <th>备注</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <!-- Modal -->
            <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel"></h4>
                        </div>
                        <div class="modal-body">
                            <div class="alert alert-danger alert-dismissable" id='modal-notify'>
                                <button type="button" class="close" id="bt-modal-notify">&times;</button>
                                <label id='lb-msg'></label>
                            </div>
                            <form class="form-horizontal" role="form">
                                <div class="form-group" id='show_id'>
                                    <label class="col-sm-3 control-label">id</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control " placeholder="" id="id">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">模板名称</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="template_name">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">资产名称</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="name">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">cpu</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="cpu">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">主板</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="board">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">固态硬盘</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="ssd">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">机械硬盘</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="disk">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">内存</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="mem">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">显卡</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="graphics">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">品牌</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="brand">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">规格</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" placeholder="" id="specification">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">使用部门</label>
                                    <div class="col-sm-8">
                                        <select id="new_organization" style="width: 100%" class="filter_select2">
                                            <option selected="selected" value="0">选择使用部门</option>
                                            {% for new_organization in all_new_organization %}
                                                <option value="{{ new_organization }}">{{ new_organization }}</option>
                                            {% endfor %}
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">备注</label>
                                    <div class="col-sm-8">
                                        <textarea rows="5" class="form-control" id="remark" style="width: 100%"></textarea>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button id='bt-save' type="button" class="btn btn-primary">保存</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
            <div class="modal fade" id="Modal-file" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">导入/导出</h4>
                        </div>
                        <div class="modal-body">
                            <div class="alert alert-dismissable" id='upload-notify'>
                                <button type="button" class="close" id="bt-upload-notify">&times;</button>
                                <label id='lb-msg-upload'></label>
                            </div>
                            <form id="submit-file-form" enctype="multipart/form-data" action="/assets/upload_devices"
                                  method="post">
                                <!-- {% csrf_token %} -->
                                <div class="form-group">
                                    {{ form }}
                                    <p class="help-block">Example block-level help text here.</p>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary" name='action'>保存</button>
                        </div>
                        </form>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div>
        </div>
    </div>
{% endblock %}
{% block bodyjs %}
    <script src="/static/js/jquery.dataTables.js"></script>
    {{ django_context_varable }}
    {% verbatim %}
    <script id="tpl" type="text/x-handlebars-template">
        {{#each func}}
        <button type="button" class="btn btn-{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>
        {{/each}}
    </script>
    {% endverbatim %}
    <script src="/static/js/handlebars-v3.0.1.js"></script>
    <script src="/static/js/assets_template.js?v=20190529001"></script>
    <script src="/static/js/dataTables.colVis.js"></script>
{% endblock %}
{% block css %}
    <link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="/static/css/mycss.css" rel="stylesheet" type="text/css">
    <link href="/static/css/dataTables.colVis.css" rel="stylesheet" type="text/css">
{% endblock %}
